{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "e096d884",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as n#导入numpy计算库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "0581e46c",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[33, 35, 77],\n",
       "       [58, 71, 58],\n",
       "       [33, 73, 76],\n",
       "       [40, 97, 49],\n",
       "       [35, 63, 46],\n",
       "       [68, 95, 46],\n",
       "       [36, 80, 88],\n",
       "       [72, 87, 79],\n",
       "       [36, 78, 71],\n",
       "       [89, 98, 43],\n",
       "       [61, 44, 67],\n",
       "       [40, 89, 33],\n",
       "       [81, 55, 76],\n",
       "       [46, 74, 75],\n",
       "       [82, 59, 39],\n",
       "       [40, 73, 98],\n",
       "       [42, 41, 78],\n",
       "       [30, 89, 94],\n",
       "       [70, 39, 56],\n",
       "       [50, 72, 43],\n",
       "       [57, 81, 87],\n",
       "       [58, 97, 79],\n",
       "       [52, 42, 66],\n",
       "       [99, 93, 67],\n",
       "       [52, 45, 64],\n",
       "       [75, 77, 86],\n",
       "       [65, 63, 55],\n",
       "       [51, 88, 31],\n",
       "       [88, 46, 74],\n",
       "       [64, 90, 67],\n",
       "       [79, 71, 44],\n",
       "       [68, 86, 42],\n",
       "       [94, 66, 42],\n",
       "       [56, 43, 94],\n",
       "       [93, 89, 70],\n",
       "       [56, 41, 95],\n",
       "       [64, 44, 32],\n",
       "       [35, 89, 59],\n",
       "       [84, 84, 63],\n",
       "       [60, 98, 50],\n",
       "       [54, 38, 67],\n",
       "       [95, 70, 71],\n",
       "       [86, 90, 52],\n",
       "       [33, 46, 31],\n",
       "       [64, 32, 66],\n",
       "       [57, 60, 91],\n",
       "       [88, 83, 70],\n",
       "       [85, 98, 73],\n",
       "       [86, 87, 35],\n",
       "       [63, 47, 75]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[51, 56, 46],\n",
       "       [88, 91, 95],\n",
       "       [65, 47, 91],\n",
       "       [74, 84, 59],\n",
       "       [93, 77, 99],\n",
       "       [80, 30, 53],\n",
       "       [52, 58, 36],\n",
       "       [35, 45, 66],\n",
       "       [67, 93, 95],\n",
       "       [80, 43, 84],\n",
       "       [60, 84, 40],\n",
       "       [81, 77, 88],\n",
       "       [82, 38, 98],\n",
       "       [57, 78, 75],\n",
       "       [47, 99, 47],\n",
       "       [61, 45, 58],\n",
       "       [83, 77, 97],\n",
       "       [50, 87, 77],\n",
       "       [49, 77, 66],\n",
       "       [48, 66, 54],\n",
       "       [37, 33, 54],\n",
       "       [60, 37, 31],\n",
       "       [52, 52, 32],\n",
       "       [45, 83, 38],\n",
       "       [45, 58, 97],\n",
       "       [51, 48, 81],\n",
       "       [32, 85, 46],\n",
       "       [32, 37, 45],\n",
       "       [81, 31, 30],\n",
       "       [37, 91, 36],\n",
       "       [43, 30, 65],\n",
       "       [30, 44, 85],\n",
       "       [39, 69, 34],\n",
       "       [75, 32, 30],\n",
       "       [77, 77, 57],\n",
       "       [70, 44, 96],\n",
       "       [49, 54, 33],\n",
       "       [82, 75, 95],\n",
       "       [42, 58, 47],\n",
       "       [76, 32, 40],\n",
       "       [76, 38, 83],\n",
       "       [69, 75, 97],\n",
       "       [81, 84, 71],\n",
       "       [43, 88, 62],\n",
       "       [50, 66, 85],\n",
       "       [76, 73, 47],\n",
       "       [32, 93, 43],\n",
       "       [91, 84, 30],\n",
       "       [36, 49, 85],\n",
       "       [41, 93, 62]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[45, 71, 48],\n",
       "       [39, 87, 33],\n",
       "       [99, 31, 36],\n",
       "       [67, 52, 83],\n",
       "       [35, 34, 50],\n",
       "       [39, 44, 81],\n",
       "       [75, 82, 87],\n",
       "       [93, 82, 31],\n",
       "       [98, 41, 46],\n",
       "       [41, 77, 83],\n",
       "       [36, 46, 61],\n",
       "       [76, 89, 76],\n",
       "       [88, 37, 55],\n",
       "       [95, 70, 49],\n",
       "       [74, 46, 61],\n",
       "       [35, 51, 76],\n",
       "       [88, 45, 36],\n",
       "       [68, 58, 41],\n",
       "       [47, 53, 97],\n",
       "       [81, 59, 70],\n",
       "       [31, 93, 66],\n",
       "       [74, 82, 33],\n",
       "       [99, 94, 66],\n",
       "       [34, 36, 84],\n",
       "       [87, 74, 91],\n",
       "       [81, 94, 80],\n",
       "       [48, 55, 73],\n",
       "       [54, 72, 39],\n",
       "       [50, 85, 32],\n",
       "       [88, 87, 74],\n",
       "       [47, 33, 95],\n",
       "       [44, 87, 68],\n",
       "       [57, 91, 81],\n",
       "       [53, 93, 42],\n",
       "       [35, 38, 62],\n",
       "       [34, 66, 46],\n",
       "       [37, 65, 39],\n",
       "       [34, 41, 79],\n",
       "       [85, 97, 78],\n",
       "       [94, 38, 95],\n",
       "       [74, 87, 51],\n",
       "       [48, 67, 50],\n",
       "       [52, 93, 83],\n",
       "       [99, 45, 36],\n",
       "       [33, 54, 46],\n",
       "       [44, 38, 34],\n",
       "       [49, 52, 46],\n",
       "       [94, 95, 47],\n",
       "       [68, 33, 81],\n",
       "       [81, 86, 46]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[66, 57, 84],\n",
       "       [43, 63, 78],\n",
       "       [50, 78, 90],\n",
       "       [37, 69, 44],\n",
       "       [77, 49, 62],\n",
       "       [63, 66, 32],\n",
       "       [44, 39, 32],\n",
       "       [43, 66, 45],\n",
       "       [57, 37, 31],\n",
       "       [82, 32, 53],\n",
       "       [45, 86, 33],\n",
       "       [46, 93, 98],\n",
       "       [83, 74, 42],\n",
       "       [91, 80, 60],\n",
       "       [31, 81, 44],\n",
       "       [47, 72, 64],\n",
       "       [93, 62, 36],\n",
       "       [73, 38, 49],\n",
       "       [47, 50, 93],\n",
       "       [55, 98, 59],\n",
       "       [36, 37, 35],\n",
       "       [41, 67, 75],\n",
       "       [42, 77, 30],\n",
       "       [48, 49, 96],\n",
       "       [51, 31, 65],\n",
       "       [35, 58, 34],\n",
       "       [45, 91, 46],\n",
       "       [99, 59, 47],\n",
       "       [99, 31, 65],\n",
       "       [50, 81, 97],\n",
       "       [94, 74, 67],\n",
       "       [83, 95, 41],\n",
       "       [64, 75, 64],\n",
       "       [94, 57, 94],\n",
       "       [39, 45, 67],\n",
       "       [98, 34, 83],\n",
       "       [55, 40, 43],\n",
       "       [96, 71, 37],\n",
       "       [40, 43, 54],\n",
       "       [43, 61, 49],\n",
       "       [56, 56, 82],\n",
       "       [71, 47, 52],\n",
       "       [83, 65, 84],\n",
       "       [47, 37, 47],\n",
       "       [53, 63, 68],\n",
       "       [90, 90, 70],\n",
       "       [98, 77, 44],\n",
       "       [64, 45, 52],\n",
       "       [78, 89, 66],\n",
       "       [77, 33, 62]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[33, 93, 97],\n",
       "       [55, 36, 79],\n",
       "       [35, 46, 74],\n",
       "       [65, 87, 82],\n",
       "       [33, 43, 88],\n",
       "       [83, 71, 87],\n",
       "       [36, 90, 94],\n",
       "       [93, 32, 87],\n",
       "       [76, 80, 37],\n",
       "       [75, 70, 57],\n",
       "       [35, 77, 50],\n",
       "       [64, 55, 50],\n",
       "       [42, 40, 70],\n",
       "       [47, 94, 98],\n",
       "       [64, 41, 69],\n",
       "       [83, 60, 60],\n",
       "       [85, 57, 79],\n",
       "       [36, 69, 45],\n",
       "       [90, 39, 46],\n",
       "       [52, 60, 66],\n",
       "       [72, 75, 93],\n",
       "       [56, 89, 73],\n",
       "       [37, 60, 66],\n",
       "       [96, 87, 42],\n",
       "       [56, 46, 87],\n",
       "       [62, 33, 32],\n",
       "       [47, 57, 57],\n",
       "       [98, 53, 64],\n",
       "       [67, 71, 64],\n",
       "       [43, 84, 57],\n",
       "       [87, 95, 54],\n",
       "       [43, 56, 97],\n",
       "       [72, 84, 33],\n",
       "       [51, 37, 86],\n",
       "       [46, 92, 41],\n",
       "       [91, 43, 34],\n",
       "       [52, 33, 48],\n",
       "       [44, 53, 84],\n",
       "       [51, 86, 57],\n",
       "       [48, 43, 67],\n",
       "       [93, 94, 52],\n",
       "       [62, 90, 49],\n",
       "       [73, 98, 52],\n",
       "       [64, 42, 55],\n",
       "       [94, 54, 68],\n",
       "       [38, 54, 47],\n",
       "       [93, 35, 45],\n",
       "       [56, 55, 43],\n",
       "       [53, 85, 78],\n",
       "       [49, 61, 50]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "array([[74, 37, 53],\n",
       "       [37, 52, 35],\n",
       "       [75, 40, 97],\n",
       "       [80, 74, 39],\n",
       "       [50, 61, 69],\n",
       "       [97, 43, 77],\n",
       "       [31, 60, 53],\n",
       "       [95, 68, 67],\n",
       "       [84, 75, 31],\n",
       "       [36, 58, 76],\n",
       "       [70, 51, 53],\n",
       "       [72, 55, 32],\n",
       "       [46, 73, 51],\n",
       "       [92, 71, 74],\n",
       "       [82, 39, 70],\n",
       "       [62, 97, 33],\n",
       "       [68, 72, 43],\n",
       "       [30, 45, 59],\n",
       "       [32, 46, 59],\n",
       "       [74, 98, 80],\n",
       "       [84, 88, 40],\n",
       "       [87, 59, 32],\n",
       "       [53, 73, 68],\n",
       "       [58, 53, 90],\n",
       "       [73, 44, 36],\n",
       "       [45, 93, 99],\n",
       "       [77, 46, 50],\n",
       "       [71, 39, 79],\n",
       "       [30, 46, 52],\n",
       "       [45, 69, 39],\n",
       "       [69, 56, 68],\n",
       "       [95, 78, 46],\n",
       "       [36, 42, 98],\n",
       "       [45, 56, 36],\n",
       "       [71, 86, 55],\n",
       "       [57, 36, 50],\n",
       "       [99, 62, 74],\n",
       "       [82, 48, 84],\n",
       "       [30, 84, 88],\n",
       "       [88, 96, 41],\n",
       "       [48, 48, 65],\n",
       "       [44, 35, 64],\n",
       "       [98, 73, 92],\n",
       "       [35, 42, 82],\n",
       "       [73, 72, 64],\n",
       "       [37, 81, 75],\n",
       "       [50, 77, 39],\n",
       "       [54, 73, 66],\n",
       "       [46, 51, 78],\n",
       "       [36, 50, 76]])"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "class1 = n.random.randint(30,100,size=(50,3))\n",
    "class2 = n.random.randint(30,100,size=(50,3))\n",
    "class3 = n.random.randint(30,100,size=(50,3))\n",
    "class4 = n.random.randint(30,100,size=(50,3))\n",
    "class5 = n.random.randint(30,100,size=(50,3))\n",
    "class6 = n.random.randint(30,100,size=(50,3))\n",
    "display(class1,class2,class3,class4,class5,class6)\n",
    "#创建6个班级，3门学科成绩，从左至右分别为python，数学、语文    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ce11d79a",
   "metadata": {
    "collapsed": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[33, 35, 77],\n",
       "       [58, 71, 58],\n",
       "       [33, 73, 76],\n",
       "       [40, 97, 49],\n",
       "       [35, 63, 46],\n",
       "       [68, 95, 46],\n",
       "       [36, 80, 88],\n",
       "       [72, 87, 79],\n",
       "       [36, 78, 71],\n",
       "       [89, 98, 43],\n",
       "       [61, 44, 67],\n",
       "       [40, 89, 33],\n",
       "       [81, 55, 76],\n",
       "       [46, 74, 75],\n",
       "       [82, 59, 39],\n",
       "       [40, 73, 98],\n",
       "       [42, 41, 78],\n",
       "       [30, 89, 94],\n",
       "       [70, 39, 56],\n",
       "       [50, 72, 43],\n",
       "       [57, 81, 87],\n",
       "       [58, 97, 79],\n",
       "       [52, 42, 66],\n",
       "       [99, 93, 67],\n",
       "       [52, 45, 64],\n",
       "       [75, 77, 86],\n",
       "       [65, 63, 55],\n",
       "       [51, 88, 31],\n",
       "       [88, 46, 74],\n",
       "       [64, 90, 67],\n",
       "       [79, 71, 44],\n",
       "       [68, 86, 42],\n",
       "       [94, 66, 42],\n",
       "       [56, 43, 94],\n",
       "       [93, 89, 70],\n",
       "       [56, 41, 95],\n",
       "       [64, 44, 32],\n",
       "       [35, 89, 59],\n",
       "       [84, 84, 63],\n",
       "       [60, 98, 50],\n",
       "       [54, 38, 67],\n",
       "       [95, 70, 71],\n",
       "       [86, 90, 52],\n",
       "       [33, 46, 31],\n",
       "       [64, 32, 66],\n",
       "       [57, 60, 91],\n",
       "       [88, 83, 70],\n",
       "       [85, 98, 73],\n",
       "       [86, 87, 35],\n",
       "       [63, 47, 75],\n",
       "       [51, 56, 46],\n",
       "       [88, 91, 95],\n",
       "       [65, 47, 91],\n",
       "       [74, 84, 59],\n",
       "       [93, 77, 99],\n",
       "       [80, 30, 53],\n",
       "       [52, 58, 36],\n",
       "       [35, 45, 66],\n",
       "       [67, 93, 95],\n",
       "       [80, 43, 84],\n",
       "       [60, 84, 40],\n",
       "       [81, 77, 88],\n",
       "       [82, 38, 98],\n",
       "       [57, 78, 75],\n",
       "       [47, 99, 47],\n",
       "       [61, 45, 58],\n",
       "       [83, 77, 97],\n",
       "       [50, 87, 77],\n",
       "       [49, 77, 66],\n",
       "       [48, 66, 54],\n",
       "       [37, 33, 54],\n",
       "       [60, 37, 31],\n",
       "       [52, 52, 32],\n",
       "       [45, 83, 38],\n",
       "       [45, 58, 97],\n",
       "       [51, 48, 81],\n",
       "       [32, 85, 46],\n",
       "       [32, 37, 45],\n",
       "       [81, 31, 30],\n",
       "       [37, 91, 36],\n",
       "       [43, 30, 65],\n",
       "       [30, 44, 85],\n",
       "       [39, 69, 34],\n",
       "       [75, 32, 30],\n",
       "       [77, 77, 57],\n",
       "       [70, 44, 96],\n",
       "       [49, 54, 33],\n",
       "       [82, 75, 95],\n",
       "       [42, 58, 47],\n",
       "       [76, 32, 40],\n",
       "       [76, 38, 83],\n",
       "       [69, 75, 97],\n",
       "       [81, 84, 71],\n",
       "       [43, 88, 62],\n",
       "       [50, 66, 85],\n",
       "       [76, 73, 47],\n",
       "       [32, 93, 43],\n",
       "       [91, 84, 30],\n",
       "       [36, 49, 85],\n",
       "       [41, 93, 62],\n",
       "       [45, 71, 48],\n",
       "       [39, 87, 33],\n",
       "       [99, 31, 36],\n",
       "       [67, 52, 83],\n",
       "       [35, 34, 50],\n",
       "       [39, 44, 81],\n",
       "       [75, 82, 87],\n",
       "       [93, 82, 31],\n",
       "       [98, 41, 46],\n",
       "       [41, 77, 83],\n",
       "       [36, 46, 61],\n",
       "       [76, 89, 76],\n",
       "       [88, 37, 55],\n",
       "       [95, 70, 49],\n",
       "       [74, 46, 61],\n",
       "       [35, 51, 76],\n",
       "       [88, 45, 36],\n",
       "       [68, 58, 41],\n",
       "       [47, 53, 97],\n",
       "       [81, 59, 70],\n",
       "       [31, 93, 66],\n",
       "       [74, 82, 33],\n",
       "       [99, 94, 66],\n",
       "       [34, 36, 84],\n",
       "       [87, 74, 91],\n",
       "       [81, 94, 80],\n",
       "       [48, 55, 73],\n",
       "       [54, 72, 39],\n",
       "       [50, 85, 32],\n",
       "       [88, 87, 74],\n",
       "       [47, 33, 95],\n",
       "       [44, 87, 68],\n",
       "       [57, 91, 81],\n",
       "       [53, 93, 42],\n",
       "       [35, 38, 62],\n",
       "       [34, 66, 46],\n",
       "       [37, 65, 39],\n",
       "       [34, 41, 79],\n",
       "       [85, 97, 78],\n",
       "       [94, 38, 95],\n",
       "       [74, 87, 51],\n",
       "       [48, 67, 50],\n",
       "       [52, 93, 83],\n",
       "       [99, 45, 36],\n",
       "       [33, 54, 46],\n",
       "       [44, 38, 34],\n",
       "       [49, 52, 46],\n",
       "       [94, 95, 47],\n",
       "       [68, 33, 81],\n",
       "       [81, 86, 46],\n",
       "       [66, 57, 84],\n",
       "       [43, 63, 78],\n",
       "       [50, 78, 90],\n",
       "       [37, 69, 44],\n",
       "       [77, 49, 62],\n",
       "       [63, 66, 32],\n",
       "       [44, 39, 32],\n",
       "       [43, 66, 45],\n",
       "       [57, 37, 31],\n",
       "       [82, 32, 53],\n",
       "       [45, 86, 33],\n",
       "       [46, 93, 98],\n",
       "       [83, 74, 42],\n",
       "       [91, 80, 60],\n",
       "       [31, 81, 44],\n",
       "       [47, 72, 64],\n",
       "       [93, 62, 36],\n",
       "       [73, 38, 49],\n",
       "       [47, 50, 93],\n",
       "       [55, 98, 59],\n",
       "       [36, 37, 35],\n",
       "       [41, 67, 75],\n",
       "       [42, 77, 30],\n",
       "       [48, 49, 96],\n",
       "       [51, 31, 65],\n",
       "       [35, 58, 34],\n",
       "       [45, 91, 46],\n",
       "       [99, 59, 47],\n",
       "       [99, 31, 65],\n",
       "       [50, 81, 97],\n",
       "       [94, 74, 67],\n",
       "       [83, 95, 41],\n",
       "       [64, 75, 64],\n",
       "       [94, 57, 94],\n",
       "       [39, 45, 67],\n",
       "       [98, 34, 83],\n",
       "       [55, 40, 43],\n",
       "       [96, 71, 37],\n",
       "       [40, 43, 54],\n",
       "       [43, 61, 49],\n",
       "       [56, 56, 82],\n",
       "       [71, 47, 52],\n",
       "       [83, 65, 84],\n",
       "       [47, 37, 47],\n",
       "       [53, 63, 68],\n",
       "       [90, 90, 70],\n",
       "       [98, 77, 44],\n",
       "       [64, 45, 52],\n",
       "       [78, 89, 66],\n",
       "       [77, 33, 62],\n",
       "       [33, 93, 97],\n",
       "       [55, 36, 79],\n",
       "       [35, 46, 74],\n",
       "       [65, 87, 82],\n",
       "       [33, 43, 88],\n",
       "       [83, 71, 87],\n",
       "       [36, 90, 94],\n",
       "       [93, 32, 87],\n",
       "       [76, 80, 37],\n",
       "       [75, 70, 57],\n",
       "       [35, 77, 50],\n",
       "       [64, 55, 50],\n",
       "       [42, 40, 70],\n",
       "       [47, 94, 98],\n",
       "       [64, 41, 69],\n",
       "       [83, 60, 60],\n",
       "       [85, 57, 79],\n",
       "       [36, 69, 45],\n",
       "       [90, 39, 46],\n",
       "       [52, 60, 66],\n",
       "       [72, 75, 93],\n",
       "       [56, 89, 73],\n",
       "       [37, 60, 66],\n",
       "       [96, 87, 42],\n",
       "       [56, 46, 87],\n",
       "       [62, 33, 32],\n",
       "       [47, 57, 57],\n",
       "       [98, 53, 64],\n",
       "       [67, 71, 64],\n",
       "       [43, 84, 57],\n",
       "       [87, 95, 54],\n",
       "       [43, 56, 97],\n",
       "       [72, 84, 33],\n",
       "       [51, 37, 86],\n",
       "       [46, 92, 41],\n",
       "       [91, 43, 34],\n",
       "       [52, 33, 48],\n",
       "       [44, 53, 84],\n",
       "       [51, 86, 57],\n",
       "       [48, 43, 67],\n",
       "       [93, 94, 52],\n",
       "       [62, 90, 49],\n",
       "       [73, 98, 52],\n",
       "       [64, 42, 55],\n",
       "       [94, 54, 68],\n",
       "       [38, 54, 47],\n",
       "       [93, 35, 45],\n",
       "       [56, 55, 43],\n",
       "       [53, 85, 78],\n",
       "       [49, 61, 50],\n",
       "       [74, 37, 53],\n",
       "       [37, 52, 35],\n",
       "       [75, 40, 97],\n",
       "       [80, 74, 39],\n",
       "       [50, 61, 69],\n",
       "       [97, 43, 77],\n",
       "       [31, 60, 53],\n",
       "       [95, 68, 67],\n",
       "       [84, 75, 31],\n",
       "       [36, 58, 76],\n",
       "       [70, 51, 53],\n",
       "       [72, 55, 32],\n",
       "       [46, 73, 51],\n",
       "       [92, 71, 74],\n",
       "       [82, 39, 70],\n",
       "       [62, 97, 33],\n",
       "       [68, 72, 43],\n",
       "       [30, 45, 59],\n",
       "       [32, 46, 59],\n",
       "       [74, 98, 80],\n",
       "       [84, 88, 40],\n",
       "       [87, 59, 32],\n",
       "       [53, 73, 68],\n",
       "       [58, 53, 90],\n",
       "       [73, 44, 36],\n",
       "       [45, 93, 99],\n",
       "       [77, 46, 50],\n",
       "       [71, 39, 79],\n",
       "       [30, 46, 52],\n",
       "       [45, 69, 39],\n",
       "       [69, 56, 68],\n",
       "       [95, 78, 46],\n",
       "       [36, 42, 98],\n",
       "       [45, 56, 36],\n",
       "       [71, 86, 55],\n",
       "       [57, 36, 50],\n",
       "       [99, 62, 74],\n",
       "       [82, 48, 84],\n",
       "       [30, 84, 88],\n",
       "       [88, 96, 41],\n",
       "       [48, 48, 65],\n",
       "       [44, 35, 64],\n",
       "       [98, 73, 92],\n",
       "       [35, 42, 82],\n",
       "       [73, 72, 64],\n",
       "       [37, 81, 75],\n",
       "       [50, 77, 39],\n",
       "       [54, 73, 66],\n",
       "       [46, 51, 78],\n",
       "       [36, 50, 76]])"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score = n.concatenate((class1,class2,class3,class4,class5,class6),axis=0)\n",
    "score#合并为socre成绩"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "19821260",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[33, 35, 77,  1],\n",
       "       [58, 71, 58,  1],\n",
       "       [33, 73, 76,  1],\n",
       "       ...,\n",
       "       [54, 73, 66,  0],\n",
       "       [46, 51, 78,  1],\n",
       "       [36, 50, 76,  0]])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sex = n.random.randint(0,2,size=(300,1))#创建性别数组 1为男，0为女生\n",
    "dataa = n.hstack((score,sex))#水平方向合并得到dataa\n",
    "dataa"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "f77c48dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "99"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "98"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "98"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "man_max_python = n.max(n.where(dataa[:,-1]==1,dataa[:,0],0))\n",
    "man_max_math = n.max(n.where(dataa[:,-1]==1,dataa[:,1],0))\n",
    "man_max_chinese = n.max(n.where(dataa[:,-1]==1,dataa[:,2],0))\n",
    "display(man_max_python,man_max_math,man_max_chinese)#男子各科最高分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "6ae4eba1",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "99"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "99"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "99"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "woman_max_python = n.max(n.where(dataa[:,-1]==0,dataa[:,0],0))\n",
    "woman_max_math = n.max(n.where(dataa[:,-1]==0,dataa[:,1],0))\n",
    "woman_max_chinese = n.max(n.where(dataa[:,-1]==0,dataa[:,2],0))\n",
    "display(woman_max_python,woman_max_math,woman_max_chinese)#女子各科最高分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "dfca16c9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "man_min_python = n.min(n.where(dataa[:,-1]==1,dataa[:,0],99))\n",
    "man_min_math = n.min(n.where(dataa[:,-1]==1,dataa[:,1],99))\n",
    "man_min_chinese = n.min(n.where(dataa[:,-1]==1,dataa[:,2],99))\n",
    "display(man_min_python,man_min_math,man_min_chinese)#男子各科最低分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "132454be",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "31"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "30"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "woman_min_python = n.min(n.where(dataa[:,-1]==0,dataa[:,0],99))\n",
    "woman_min_math = n.min(n.where(dataa[:,-1]==0,dataa[:,1],99))\n",
    "woman_min_chinese = n.min(n.where(dataa[:,-1]==0,dataa[:,2],99))\n",
    "display(woman_min_python,woman_min_math,woman_min_chinese)#女子各科最低分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "3421418d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:61.64,数学:63.27,语文:59.83\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==1)#男生所在的行数\n",
    "p = n.mean(dataa[ss,0])\n",
    "m = n.mean(dataa[ss,1])\n",
    "c = n.mean(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#男生各科平均分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "7f41c511",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:61.72,数学:64.79,语文:64.19\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==0)#女生所在的行数\n",
    "p = n.mean(dataa[ss,0])\n",
    "m = n.mean(dataa[ss,1])\n",
    "c = n.mean(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#女生各科平均分"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "b0fe5c8a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:58.00,数学:60.00,语文:58.00\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==1)#男生所在的行数\n",
    "p = n.median(dataa[ss,0])\n",
    "m = n.median(dataa[ss,1])\n",
    "c = n.median(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#男生各科中位数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "fc2f3e14",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:57.00,数学:66.00,语文:66.00\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==0)#女生所在的行数\n",
    "p = n.median(dataa[ss,0])\n",
    "m = n.median(dataa[ss,1])\n",
    "c = n.median(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#女生各科中位数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "0729bb99",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:20.78,数学:20.46,语文:19.96\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==1)#男生所在的行数\n",
    "p = n.std(dataa[ss,0])\n",
    "m = n.std(dataa[ss,1])\n",
    "c = n.std(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#男生各科标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "a64ec45d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python:20.49,数学:20.28,语文:20.05\n"
     ]
    }
   ],
   "source": [
    "ss = n.where(dataa[:,-1]==0)#女生所在的行数\n",
    "p = n.std(dataa[ss,0])\n",
    "m = n.std(dataa[ss,1])\n",
    "c = n.std(dataa[ss,2])\n",
    "print('Python:%.2f,数学:%.2f,语文:%.2f'%( p,m,c))#女生各科标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f7f59477",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
